home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_8.lha
/
5_8
/
5_8a5.h
< prev
next >
Wrap
Text File
|
1993-08-08
|
538b
|
29 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ Uniform distribution in the interval [0,LONG_MAX)
/ and [0,1).
include <limits.h>
lass randint
long randx;
void getx() { randx = randx * 1103515245 + 12345; }
ublic:
randint(long s = 0) { randx = s; }
void seed(long s) { randx = s; }
int draw()
{
getx();
return randx & LONG_MAX;
}
float fdraw()
{
getx();
return (randx & LONG_MAX) / (float) LONG_MAX;
}
;